package net.runsystem.magiccloud;

import net.runsystem.magiccloud.adapter.OnFragmentClickListener;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;

public class A03_NewAccount extends Fragment implements OnClickListener {

	public static final int A03_FRAGMENT_CODE = 103;
	OnFragmentClickListener onFragmentClickListener;

	ImageView btOK;
	ImageView btAssetCode;

	EditText textName;
	EditText textId;
	EditText textPass;
	EditText textTel;
	EditText textMail;
	EditText textAssetCode;
	EditText textRePass;

	View root;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		// return super.onCreateView(inflater, container, savedInstanceState);
		root = inflater.inflate(R.layout.a03_layout, container, false);

		btOK = (ImageView) root.findViewById(R.id.a03_bt_Oki);
		btAssetCode = (ImageView) root.findViewById(R.id.a03_bt_AssetCode);

		textAssetCode = (EditText) root.findViewById(R.id.a03_text_AssetCode);
		textId = (EditText) root.findViewById(R.id.a03_text_ID);
		textMail = (EditText) root.findViewById(R.id.a03_text_Mail);
		textName = (EditText) root.findViewById(R.id.a03_text_Name);
		textPass = (EditText) root.findViewById(R.id.a03_text_Pass);
		textTel = (EditText) root.findViewById(R.id.a03_text_tel);
		textRePass = (EditText) root.findViewById(R.id.a03_text_RePass);

		btOK.setOnClickListener(this);
		btAssetCode.setOnClickListener(this);

		return root;
	}

	@Override
	public void onClick(View arg0) {

		// TODO Auto-generated method stub
		switch (arg0.getId()) {
		case R.id.a03_bt_Oki:
			// next page
			if (onFragmentClickListener != null) {
				onFragmentClickListener.onSwitchFragment(
						A04_Infor.A04_FRAGMENT_CODE, null);
			}
			break;
		case R.id.a03_bt_AssetCode:

			break;
		default:
			break;
		}

	}

	@Override
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		try {
			onFragmentClickListener = (OnFragmentClickListener) activity;
		} catch (ClassCastException e) {
			throw new ClassCastException(activity.toString()
					+ " must implement OnFragmentClickListener");
		}
	}

}
